<!--页面配置页面-->
<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-sys__good">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item prop="pageName">
          <el-input v-model="dataForm.pageName" placeholder="请输入页面名称" clearable></el-input>
        </el-form-item>
        <el-form-item prop="pageLocation">
          <ren-select v-model="dataForm.pageLocation" dict-type="pageLocation" placeholder="请选择页面位置"></ren-select>
        </el-form-item>
        <el-form-item prop="pagePath">
          <ren-select v-model="dataForm.pagePath" dict-type="pagePath" placeholder="请选择页面路径"></ren-select>
        </el-form-item>
        <el-form-item>
          <el-button  v-if="$hasPermission('api:configPage:page')" @click="getDataList()">查询</el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('api:configPage:save')" type="primary" @click="addOrUpdateHandle()">
            新增
          </el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('api:configPage:delete')" type="danger" @click="deleteHandle()">
            删除
          </el-button>
        </el-form-item>
      </el-form>
      <el-table
          v-loading="dataListLoading"
          :data="dataList"
          stripe highlight-current-row
          @selection-change="dataListSelectionChangeHandle"
          @sort-change="dataListSortChangeHandle"
          style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
        <el-table-column prop="imageUrl" label="图片" header-align="center" align="left" width="">
          <template slot-scope="{row}">
            <!-- 图片展示 -->
            <el-popover trigger="click" placement="top" popper-class="popper">
              <img v-if="row.imageUrl" :src="row.imageUrl">
              <el-image v-if="row.imageUrl" slot="reference" :src="row.imageUrl" fit="contain" style="height: 70px;" class="flex_jufy_center">
                <div slot="error">
                  暂无图片
                </div>
              </el-image>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column prop="videoUrl" label="视频" header-align="center" align="left" width="">
          <template slot-scope="{row}">
            <!-- 图片展示 -->
            <video :src="row.videoUrl" controls="controls" width="260px" height="100px" v-if="row.videoUrl"></video>
          </template>
        </el-table-column>
        <el-table-column prop="pageName" label="页面名称" header-align="center" align="center" width="" show-overflow-tooltip></el-table-column>
        <el-table-column prop="pageLocation" label="页面位置" header-align="center" align="center" width="" show-overflow-tooltip>
          <template slot-scope="{row,$index}">
            <div v-if="row.pageLocation === 1" size="small" type="success">
              {{ $getDictLabel("pageLocation", row.pageLocation) }}
            </div>
            <div v-else size="small" type="info">{{
                $getDictLabel("pageLocation", row.pageLocation)
              }}
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="pageParam" label="页面参数" header-align="center" align="center" width="" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="pagePath" label="页面路径" header-align="center" align="center" width="" show-overflow-tooltip>
          <template slot-scope="{row,$index}">
            <div>
              {{ $getDictLabel("pagePath", row.pagePath) }}
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="createDate" label="创建日期" header-align="center" align="center"></el-table-column>
        <el-table-column label="操作" fixed="right" header-align="center" align="center" width="">
          <template slot-scope="scope">
            <el-link v-if="$hasPermission('api:configPage:update')" type="primary"
                       @click="addOrUpdateHandle(scope.row.id)">修改
            </el-link>
            <el-link v-if="$hasPermission('api:configPage:delete')"
                     type="primary"
                     @click="deleteHandle(scope.row.id)">删除
            </el-link>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
          :current-page="page"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="limit"
          :total="total"
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="pageSizeChangeHandle"
          @current-change="pageCurrentChangeHandle">
      </el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './configPageAddOrUpdate.vue'

export default {
  mixins: [mixinViewModule],
  data() {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/api/configPage/page',
        getDataListIsPage: true,
        deleteURL: '/api/configPage',
        deleteIsBatch: true
      },
      dataForm: {
        id: '',
        imageUrl: '',            //页面外观
        pageLocation: '',        //页面位置
        pageName: '',            //页面名称
        pageParam: '',           //页面参数
        pagePath: '',	           //页面路径
      }
    }
  },
  components: {
    AddOrUpdate
  },
  created() {
  },
  mounted() {},
  methods:{}
}
</script>
<style lang="scss" scoped>
::v-deep .el-image__inner {
  //height: 50px;
}
img {
  height: 400px;
}
</style>
